package com.jiazhong.cloud.example.student.student.controller;

import com.jiazhong.cloud.example.student.commons.bean.Student;
import com.jiazhong.cloud.example.student.commons.util.JsonResult;
import com.jiazhong.cloud.example.student.student.service.StudentService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/student")
public class StudentController {
    @Resource
    private StudentService studentService;

    @PostMapping
    public JsonResult save(Student student) {
        return studentService.saveStudent(student);
    }

    @GetMapping("/find_id/{id}")
    public JsonResult findById(@PathVariable("id") String id) {
        return studentService.findStudentById(id);
    }

    @GetMapping("/find_no/{no}")
    public JsonResult findByNo(@PathVariable("no") String no) {
        return studentService.findStudentByNo(no);
    }
}
